import { LAYOUT } from '@/router/constant';

const editChildren = [
  {
    path: 'consume',
    name: 'ProConsume',
    component: () => import('@/views/product/list/consume.vue'),
    meta: {
      title: '配料',
      keepAlive: true,
    },
  },

  {
    path: 'card-goods',
    name: 'ProCardGoods',
    component: () => import('@/views/product/list/card-goods.vue'),
    meta: {
      title: '添加服务',
      keepAlive: true,
    },
  },

  {
    path: 'card-give',
    name: 'ProCardGive',
    component: () => import('@/views/product/list/card-give.vue'),
    meta: {
      title: '添加权益',
      keepAlive: true,
    },
  },
];

export default {
  path: '/product',
  name: 'Product',
  component: LAYOUT,

  meta: {
    title: '商品',
    hideBreadcrumb: true,
  },
  children: [
    {
      path: 'list',
      name: 'ProList',
      component: () => import('@/views/product/list/index.vue'),
      meta: {
        title: '商品列表',
        showNav: true,
      },

      children: [
        {
          path: 'add',
          name: 'ProAdd',
          component: () => import('@/views/product/list/edit.vue'),
          meta: {
            title: '新增商品',
            behavior: 'add',
            keepAlive: true,
          },

          children: editChildren,
        },
        {
          path: 'edit',
          name: 'ProEdit',
          component: () => import('@/views/product/list/edit.vue'),
          meta: {
            title: '编辑商品',
            behavior: 'edit',
            keepAlive: true,
          },

          children: editChildren,
        },
      ],
    },
  ],
};
